package handler

import (
	"6-17yk/client/client"
	"6-17yk/client/request"
	"6-17yk/client/response"
	"6-17yk/common/proto/user"
	"github.com/gin-gonic/gin"
)

func SmsSend(c *gin.Context) {
	var data request.SmsSend
	err := c.ShouldBind(&data)
	if err != nil {
		response.ResponseError(c, err.Error())
		return
	}
	send, err := client.SmsSend(c, &user.SmsSendReq{
		Phone:  data.Phone,
		SouRes: data.SouRes,
	})
	if err != nil {
		response.ResponseError(c, err.Error())
		return
	}
	response.ResponseSuccess(c, send)
}
func Login(c *gin.Context) {
	var data request.Login
	err := c.ShouldBind(&data)
	if err != nil {
		response.ResponseError(c, err.Error())
		return
	}
	send, err := client.Login(c, &user.LoginReq{
		Phone:    data.Phone,
		Password: data.Password,
		Name:     data.Name,
		SouRes:   data.SouRes,
	})
	if err != nil {
		response.ResponseError(c, err.Error())
		return
	}
	response.ResponseSuccess(c, send)
}
